package com.zhiyou100.video.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiyou100.video.dao.SpeakerDao;
import com.zhiyou100.video.model.Speaker;
import com.zhiyou100.video.service.SpeakerService;
import com.zhiyou100.video.utils.Page;
@Service
public class SpeakerServiceImpl implements SpeakerService {
	@Autowired
	SpeakerDao sd;
	@Override
	public Page<Speaker> selectSpeaker(DetachedCriteria dc, Integer currentpage) {
		Integer count = sd.selectCount(dc);
		List<Speaker> list = sd.selectSpeaker(dc,currentpage);
		Page<Speaker> page = new Page<Speaker>();
		page.setPage(currentpage);
		page.setSize(5);
		page.setRows(list);
		page.setTotal(count);
		return page;
	}
	@Override
	public void addSpeaker(Speaker speaker) {
		sd.addSpeaker(speaker);
	}
	@Override
	public void deletespeaker(Integer did) {
		sd.deletespeaker(did);
	}
	@Override
	public Speaker selectSpeakerManage(Integer id) {
		return sd.selectSpeakerManage(id);
	}

}
